<?php
// $Id$

global $g_boot_time;
$g_boot_time = microtime(true);

$app_config = require(dirname(__FILE__) . '/../config/boot.php');
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR'] . '/myapp.php';

error_reporting(E_ALL ^ E_NOTICE);
$public_dir =  substr($_SERVER['PHP_SELF'], 0, -9);

Q::loadFile('config.php', $app_config['APP_DIR'].'/config');
Q::loadFile('connection.class.php', $app_config['APP_DIR'].'/core');
Q::loadFile('redis.class.php', $app_config['APP_DIR'].'/core');
Q::loadFile('util.php', $app_config['APP_DIR'].'/helper');

$ret = MyApp::instance($app_config)->dispatching();
if (is_string($ret)) echo $ret;

$g_end_time = microtime(true);

if (Q::ini('appini/DEBUG') == 'true' && isset($_GET['debug']) && $_GET['debug']=='true')
{
	require_once '../app/core/connection.class.php';
	$db = Connection::getInstance();
	echo '<pre>';
	echo 'READ: '. $db->getNumOfRead(). ' WRITE: '. $db->getNumOfWrite(). ' Total Time: '. ($g_end_time-$g_boot_time). " sec\n";
	print_r($_SESSION);
	echo '</pre>';
}

return $ret;
